package rsschart.charter;

public class CharterFactory {
	
	public static Charter getCharter(String chartType) throws Exception {
		
		Charter chart;
		
		if (chartType.equalsIgnoreCase("bar")) {
			chart = new BarChart();
		}
		else if (chartType.equalsIgnoreCase("line")) {
			chart = new LineChart();
		}
		else if (chartType.equalsIgnoreCase("pie")) {
			chart = new PieChart();
		}
		else if (chartType.equalsIgnoreCase("groupBar")) {
			chart = new GroupBarChart();
		}
		else if (chartType.equalsIgnoreCase("stackBar")) {
			chart = new StackBarChart();
		}
		else {
			//-- to do: make rsschart exception class hierarchy
			throw new Exception("Undefined chart type: " + chartType + ". Expected: bar|line|pie|groupBar|stackBar");
		}

		return chart;
		
	}

}
